#include <QCoreApplication>
#include "RemoteControl.h"
#include "GargeDoorOpenCommand.h"
#include "GargeDoorOffCommand.h"
#include "GargeDoor.h"
#include "StereOnWithCDCommand.h"
#include "Stereo.h"

#define SAVE_DELETE_PTR(ptr) { if(nullptr != ptr) { delete ptr; ptr = nullptr;}}

void remoteControlTest()
{
    RemoteControl *remoteControl = new RemoteControl();

    GargeDoor *gargeDoor = new GargeDoor();
    GargeDoorOpenCommand *gargeDoorOpen = new GargeDoorOpenCommand(gargeDoor);
    GargeDoorOffCommand  *gargeDoorOff = new GargeDoorOffCommand(gargeDoor);


    Stereo *stereo = new Stereo();
    StereOnWithCDCommand *stereOnWithCommand = new StereOnWithCDCommand(stereo);

    remoteControl->setCommand(0, gargeDoorOpen, gargeDoorOff);

    remoteControl->onButtonWasPushed(0);
    remoteControl->offButtonWasPushed(0);
    std::string remoteStr = remoteControl->toString();
    qDebug() << QString::fromStdString(remoteStr);

}

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);
    remoteControlTest();
    return a.exec();
}
